package STO_16;

public class Solution {
	public double myPow(double x, int n) {
		if (x == 0) {
			return x;
		}
		long b = n;
		double res =1.0;
		if (b < 0) {
			x = 1 / x;
			b = -b;
		}
		while (b>0) {
			if ((b&1)==1) {
				res *=x; 
			}
			x*=x;
			b>>>=1;
		}
		return res;
	}
}
